package cn.lhjl.day06.斗地主;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

public class DouDiZhu {
    public static void main(String[] args) {
        //準備牌
        ArrayList<String> poker = new ArrayList<>();
        String[] colors = new String[4];
        colors[0]="♦";
        colors[1]="♥";
        colors[2]="♠";
        colors[3]="♣";
        String[] numbers = new String[13];
        numbers[0]="2";
        numbers[1]="A";
        numbers[2]="K";
        numbers[3]="Q";
        numbers[4]="J";
        numbers[5]="10";
        numbers[6]="9";
        numbers[7]="8";
        numbers[8]="7";
        numbers[9]="6";
        numbers[10]="5";
        numbers[11]="4";
        numbers[12]="3";
        for (String number : numbers) {
            for (String color:colors) {
                poker.add(color+number);
            }
        }
        poker.add("大王");
        poker.add("小王");
        //洗牌
        Collections.shuffle(poker);
        //發牌
        ArrayList<String> player1 = new ArrayList<>();
        ArrayList<String> player2 = new ArrayList<>();
        ArrayList<String> player3 = new ArrayList<>();
        ArrayList<String> dPai = new ArrayList<>();

        for (int i = 0; i < poker.size(); i++) {
            if (i>=51){
                dPai.add(poker.get(i));
            }else if (i%3==0){
                player1.add(poker.get(i));
            }else if (i%3==1){
                player2.add(poker.get(i));
            }else {
                player3.add(poker.get(i));
            }
        }
        System.out.println("底牌："+dPai);
        System.out.println("周潤發"+player1);
        System.out.println("龍五"+player2);
        System.out.println("周星馳"+player3);
    }

}
